function [T,n,nftot,k,r,p_final,VarTypeInd,WhereNonMonthly,nnonmonthly,nmonthly] = SetDimensionsOfStateSpace_Extended(y,trend,include_trend,...
    WhereQuarterly,soft6)
%UNTITLED2 Summary of this function goes here
%   Detailed explanation goes here


[T, n] = size(y);              % Size of panel


nquarterly = size(WhereQuarterly,2);

WhereNonMonthly = [WhereQuarterly];

VarTypeInd = zeros(n,1);

VarTypeInd(WhereQuarterly,1)=300; 
VarTypeInd(soft6,1)=6; 

nmonthly = n - nquarterly;
nnonmonthly = n - nmonthly;

pmax = 0;


if nquarterly > 0 
    pmax = 5;
end

if size(soft6) > 0
    pmax = 6+2;
end


pmax = max(2,pmax);

 
p_final = max(pmax+5,2+2+5); 
nftot = 1+nnonmonthly+trend;
k = nftot*p_final; % Dimension of the final state vector   



if trend == 1
    nlocmatrix  = eye(1,n);   
    nlocmatrix(1,include_trend) = 1;
end

r = 0;

end

